

import javax.swing.*;
import java.awt.event.*;


public class NewCreateAccountFrame extends JFrame {
    public static void makeCreateAccountFrame() {
        JFrame frameTable = new JFrame();
    }

    JLabel welcome = new JLabel( "Please enter a username and a password" );
    JPanel panel = new JPanel();
    JButton blogin = new JButton("Make My Account");
    JTextField txuser = new JTextField(15);
    JPasswordField pass = new JPasswordField(15);
    JTextField userCardDetails = new JTextField(20);
    JLabel labelUser = new JLabel( "Username" );
    JLabel labelPassword = new JLabel( "Password" );
    JLabel labelUserCardDetails = new JLabel( "Credit-Card Number" );

    NewCreateAccountFrame(){
        super("Create Account");
        setSize(450,250);
        setLocation(500,280);
        panel.setLayout (null);

        welcome.setBounds(150,5,300,60);
        txuser.setBounds(200,50,150,20);
        pass.setBounds(200,85,150,20);
        userCardDetails.setBounds( 200, 120, 150, 20);
        blogin.setBounds(200,150,150,20);
        labelUser.setBounds(25,50,100,20);
        labelPassword.setBounds(25,85,100,20);
        labelUserCardDetails.setBounds(25,120,150,20);

        panel.add(welcome);
        panel.add(blogin);
        panel.add(txuser);
        panel.add( userCardDetails);
        panel.add( pass );
        panel.add( labelUser );
        panel.add( labelPassword );
        panel.add( labelUserCardDetails );

        getContentPane().add(panel);
        setVisible(true);
        actionLogin();
    }

    public void actionLogin(){

        blogin.addActionListener( new ActionListener() {
            public void actionPerformed( ActionEvent ae ){

                String userName = txuser.getText();
                userName = userName.replace("\"", "");
                String userPassword = pass.getText();
                userPassword = userPassword.replace("\"", "");
                Long userCreditCardDetails = Long.parseLong( userCardDetails.getText() );

                CreateAccount.enterDetails( userName, userPassword, userCreditCardDetails );
                JOptionPane.showMessageDialog( null,"Your account has been created" );
                dispose();
            }
        });
    }
}

